package com.dxy.yesas2020goals.study.partone.disignpattern.strategypattern.mine;

import java.util.HashMap;
import java.util.Map;

/**
 * @author victorydeng
 * @Classname PayStrateFactory
 * @Description TODO
 * @Date 2020/3/23 19:44
 * @Created by victorydeng
 */
public class PayStrateFactory {

    private static final PayStrateFactory  INSTANCE = new PayStrateFactory();

    //存放策略的Map
    private static Map<String, PayStrategy> containerMap = new HashMap<>();

    private  PayStrateFactory() {
    }

    public static PayStrateFactory getInstance(){
        return  INSTANCE;
    }

    //初始策略
    static {
        containerMap.put(InnerInit.APPLY.toString(), new ApplyPayStrategy());
        containerMap.put(InnerInit.SUCCESS.toString(), new SuccePayStrategy());
        containerMap.put(InnerInit.FAIL.toString(), new FailPayStrategy());
    }

    public PayStrategy getPayStrategy(String caseStatus) {
        return containerMap.get(caseStatus);
    }


    enum  InnerInit{
        APPLY,
        SUCCESS,
        FAIL;
    }








}
